<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#assign css>
<link rel="stylesheet" href="/assets/vendor/iCheck/all.css">
    <link rel="stylesheet" href="/assets/vendor/bootstrap-timepicker/css/bootstrap-timepicker.min.css">


<style>
</style>
</#assign>
<#assign js>
<script src="/assets/vendor/iCheck/icheck.js" ></script>
    <script src="/assets/vendor/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script>
    <script type="text/javascript" src="/assets/vendor/bootstrap-timepicker/locales/bootstrap-timepicker.zh-CN.js"
            charset="UTF-8"></script>
<script>

    $(".btn-submit").click(function () {
        // 校验表单合法
        var bootstrapValidator = $(".form-edit").data('bootstrapValidator');
        bootstrapValidator.validate();
        if (bootstrapValidator.isValid()) {
            $.ajax({
                type: "POST",
                url: "/sysParam/edit",
                data: $(".form-edit").serialize(),
                dataType: "JSON",
                success: function (res) {
                    layer.msg(res.message, {
                        time: 2000
                    }, function () {
                        location.href = "/sysParam/index";
                    });
                }
            });
        } else {
            return false;
        }
    });

    $('.form-edit').bootstrapValidator({
        message: '请输入有效值 ',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        }
    });

    $(function () {

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        })
        //Red color scheme for iCheck
        $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
            checkboxClass: 'icheckbox_minimal-red',
            radioClass: 'iradio_minimal-red'
        })
        //Flat red color scheme for iCheck
        $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
            checkboxClass: 'icheckbox_flat-green',
            radioClass: 'iradio_flat-green'
        });


        $('#nightS').timepicker({
            autoclose: true,
            format: "HH:mm:ss",
            showMeridian: false,
            todayHighlight: true,
            language: "zh-CN"
        });
        $('#nightE').timepicker({
            autoclose: true,
            format: "HH:mm:ss",
            showMeridian: false,
            todayHighlight: true,
            language: "zh-CN"
        });


    });

    function off(id) {
        layer.confirm('确定停用吗?', {icon: 3, title: '提示'}, function (index) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/sysParam/off/" + id,
                success: function (res) {
                    layer.msg(res.message, {time: 2000}, function () {
                        location.reload();
                    });
                }
            });
        });
    }

    function on(id) {
        layer.confirm('确定启用吗?', {icon: 3, title: '提示'}, function (index) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/sysParam/on/" + id,
                success: function (res) {
                    layer.msg(res.message, {time: 2000}, function () {
                        location.reload();
                    });
                }
            });
        });
    }


</script>
</#assign>
<@layout title="临时加价参数设置" active="sysParam">
<!-- Content Header (Page header) -->

<!-- Main content -->
<section class="content">
    <!-- Default box -->
    <div class="box box-primary">
        <div class="box-header">
        <#--<@shiro.hasPermission name="system:sysParam:add">
			<a class="btn btn-sm btn-success" href="/sysParam/add">新增</a>
        </@shiro.hasPermission>-->
        </div>
        <div class="box-body">
            <form class="form-horizontal form-edit" method="post" action="sysParam/edit">
                <div class="box-body">


                    <div class="form-group">
                        <label style="padding-right: 30px">
                            <input type="radio" name="type" value="1" class="flat-red" <#if sysParam.type=="1">checked</#if>>
                            深夜服务临时加价
                        </label>
                        <input placeholder="请输入金额" id="nightAmt" name="nightAward"
                               class="form-control" style="width: 200px;display: inline;padding-right: 20px;"   type="text" value="${(sysParam.nightAward?string('0.00'))!}">元

                        <input placeholder="开始时间" id="nightS" name="startTime"
                               class="form-control" style="width: 200px;display: inline"   type="text" value="${sysParam.startTime!}">

                        <input placeholder="结束时间" id="nightE" name="endTime"
                               class="form-control" style="width: 200px;display: inline" type="text" value="${sysParam.endTime!}">

                    </div>

                    <div class="form-group">
                        <label style="padding-right: 30px">
                            <input type="radio" name="type" value="2" class="flat-red" <#if sysParam.type=="2">checked</#if>>
                            特殊天气临时加价
                        </label>
                        <input placeholder="请输入金额" id="weatherAmt" name="weatherAward"
                               class="form-control" style="width: 200px;display: inline"   type="text" value="${(sysParam.weatherAward?string('0.00'))!}">元

                    </div>
                    <div class="form-group">
                        <label style="padding-right: 30px">
                            <input type="radio" name="type" value="3" class="flat-red" <#if sysParam.type=="3">checked</#if>>
                            节假日 临时加价
                        </label>
                        <input placeholder="请输入金额" id="holidayAmt" name="holidayAward"
                               class="form-control" style="width: 200px;display: inline"   type="text" value="${(sysParam.holidayAward?string('0.00'))!}">元

                    </div>


                    <div class="box-footer">
                        <button type="button" class="btn btn-info  btn-submit">提交</button>
                    </div>

            </form>
        </div>
    </div>
    <!-- /.box -->

</section>
<!-- /.content -->
</@layout>
